<script setup lang="ts">
import * as echarts from 'echarts'
const charts = ref()
let option = {
  xAxis: {
    type: 'category'
  },
  yAxis: {},
  series: [
    {
      type: 'bar',
      data: [10, 20, 30, 40, 50, 60, 70],
      label: {
        show: true,
        position: 'insideTop'
      },
      itemStyle: {
        borderRadius: [10, 10, 0, 0],
        color: function (data) {
          let arr = ['red', 'orange', 'yellow', 'green', 'purple', 'hotpink', 'skyblue']
          return arr[data.dataIndex]
        }
      }
    },
    {
      type: 'bar',
      data: [20, 30, 40, 50, 60, 70, 90],
      label: {
        show: true,
        position: 'insideTop'
      },
      itemStyle: {
        borderRadius: [10, 10, 0, 0],
        color: function (data) {
          let arr = ['red', 'orange', 'yellow', 'green', 'purple', 'hotpink', 'skyblue']
          return arr[data.dataIndex]
        }
      }
    },
    {
      type: 'line',
      data: [20, 40, 50, 40, 50, 60, 90]
    }
  ],
  grid: {
    left: 10,
    top: 10,
    right: 20,
    bottom: 10
  }
}
onMounted(() => {
  let myecharts = echarts.init(charts.value)
  // 设置echarts配置项
  myecharts.setOption(option)
})
</script>

<template>
  <div class="box1">
    <div class="top">
      <p class="title">月度新增签约</p>
      <p class="bg"></p>
    </div>
    <div class="charts" ref="charts"></div>
  </div>
</template>

<style lang="scss" scoped>
.box1 {
  background: url(../images/dataScreen-main-lb.png) no-repeat;
  background-size: 100% 100%;
  margin-top: 10px;
  .top {
    margin: 10px 0 0 20px;
    .title {
      color: white;
      font-size: 20px;
    }
    .bg {
      width: 100px;
      height: 7px;
      background: url(../images/dataScreen-title.png) no-repeat;
      background-size: 100% 100%;
      margin-top: 10px;
    }
  }
  .charts {
    width: 100%;
    height: 240px;
  }
}
</style>
